<template>
  <div>
    <h2>所有任务</h2>
    <ul class="task-list">
      <li v-for="(task, index) in tasks" :key="index" class="task-item">
        <span>{{ task.title }}</span>
        <span class="status">{{ task.status }}</span>
      </li>
    </ul>
    <p v-if="tasks.length === 0" class="empty">暂无任务</p>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'

const tasks = ref([])

// 模拟数据
onMounted(() => {
  const mockTasks = [
    { title: '完成项目需求文档', status: '进行中' },
    { title: '编写前端页面代码', status: '已完成' },
    { title: '测试接口联调', status: '待开始' }
  ]
  tasks.value = mockTasks
})
</script>

<style>
.task-list {
  list-style: none;
  padding: 0;
}

.task-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 14px;
}

.status {
  color: #007bff;
  font-weight: 500;
}

.empty {
  text-align: center;
  color: #6c757d;
  font-style: italic;
  margin-top: 20px;
}
</style>